n, k = map(int, input().split())
l = [i for i in range(1, n + 1)]
ind = 0
while l:
    for _ in range(k):
        if ind == len(l):
            ind = 0
        ind += 1
    ind -= 1
    print(l[ind], end=' ')
    del l[ind]